package com.safety51.bootstrap.demo.domain.rpc;

import com.safety51.bootstrap.api.psvc.IDemoFeignProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * Created by liuyuancheng on 2021/9/7  <br/>
 *
 * @author liuyuancheng
 */
@Service
public class CallFeignServiceExample {

    @Resource
    private IDemoFeignProvider demoFeignProvider;

    @Autowired
    private RestTemplate restTemplate;

    public String ping(String name){
        return demoFeignProvider.ping(name);
    }

    /**
     * 服务间调用
     */
    public void restTemplateRpc(){
        restTemplate.getForObject("http://psvc/shengxingapi/psvc/",String.class);
    }
}
